package it.unical.canonaco.rende.igpe.game.cbv.logiclayer.engine.ai.decisiontreeai;

public class DecisionNode extends AbstractDTNode {

	/** 
	 * Left node is the "yes" choice
	 */
	private AbstractDTNode yesNode;
	
	/**
	 * Right node is the "no" choice
	 */
	private AbstractDTNode noNode;
	
	private DecisionAlgorithm dAlg;
	
	public DecisionNode() {
		 
	}
	
	public DecisionNode(DecisionAlgorithm decisionAlgorithm) {
		
		this.setdAlg(decisionAlgorithm);
	}

	@Override
	public void makeDecision() {
		
		if(dAlg.chooseNode()){
			System.out.println("SI.");
			getYesNode().makeDecision();
			
		} 
		else {
		System.out.println("NO.");
		getNoNode().makeDecision();
		}
	}

	public DecisionAlgorithm getdAlg() {
		return dAlg;
	}

	public void setdAlg(DecisionAlgorithm dAlg) {
		this.dAlg = dAlg;
	}

	public AbstractDTNode getYesNode() {
		return yesNode;
	}

	public void setYesNode(AbstractDTNode yesNode) {
		this.yesNode = yesNode;
	}

	public AbstractDTNode getNoNode() {
		return noNode;
	}

	public void setNoNode(AbstractDTNode noNode) {
		this.noNode = noNode;
	}
	
}
